/**
 * @author QinGuan
 * @date:2016-1-13 上午09:24:20
 * @version :3.0
 *
 */
package com.ctvit.common;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.cctv.cdm.schema.channelinfotype._1.ChannelInfoType;
import com.cctv.cdm.schema.directsendnotificationtype._1.DirectSendNotificationType;
import com.cctv.cdm.schema.liveprogramnotificationtype._1.LiveProgramNotificationType;
import com.cctv.eip.messagingplatformservice._0.MessageCommonDataType;
import com.cctv.esb.schema.commoncomplextype._0.UserInfoType;
import com.cctv.esb.schema.messagehead._0.RequestHeadType;
import com.cctv.mcs.schema.sendmsgservice._1.SendMsgServiceRequestType;
import com.cctv.ppm.schema.ppm_commondatatypes._0.BroadcastListChangeInfoType;
import com.cctv.ppm.schema.ppm_commondatatypes._0.BroadcastListInfoType;
import com.cctv.ppm.schema.ppm_commondatatypes._0.BroadcastListItemType;
import com.ctvit.sms.platform.domain.MsgReq;
import com.ctvit.wsservice.basedata.domain.*;
import com.ctvit.wsservice.basedata.service.TaskChangePortService;

public class EntityClassSet {

	/**
	 * 
	 * @ps:为节目单主表赋值
	 * @param broadcastListInfoType节目单类型
	 * @return 节目单主表
	 */
	public ZcdmTProrec setZcdmTProrec(BroadcastListInfoType broadcastListInfoType, ZcdmTProrec zcdmTProrec) {
		if (broadcastListInfoType == null) {
			return null;
		}
		zcdmTProrec = new ZcdmTProrec();
		zcdmTProrec.setZProRecCd(broadcastListInfoType.getBroadcastListID());// 节目播出单标识
		zcdmTProrec.setZPlayDate(broadcastListInfoType.getPlayDate().toGregorianCalendar().getTime()); // 播出日期
		zcdmTProrec.setZChanlCd(broadcastListInfoType.getChannelCode());// 频道代码
		zcdmTProrec.setZDraftTp(broadcastListInfoType.getPlayListType().value()); // 节目单类型
		zcdmTProrec.setZVersionNo(broadcastListInfoType.getPlaylistVersion().longValue());// 版本号
		zcdmTProrec.setZLockstatus(broadcastListInfoType.getPlaylistLockStatus()); // 发布锁定
		return zcdmTProrec;
	}

	/**
	 * 
	 * @ps:为节目单子表赋值
	 * @param date播出日期
	 * @param channelCode频道代码
	 * @param broadcastListItemTypes节目单条目类型
	 * @param zcdmTProglist节目单子表
	 * @return 节目单子表集合
	 */
	public List<ZcdmTProglist> setZcdmTProglist(Date date, String channelCode, List<BroadcastListItemType> broadcastListItemTypes,
			ZcdmTProglist zcdmTProglist) {
		if (broadcastListItemTypes == null) {
			return null;
		}
		List<ZcdmTProglist> ListZcdmTProglist = new ArrayList<ZcdmTProglist>();
		for (int i = 0; i < broadcastListItemTypes.size(); i++) {
			BroadcastListItemType broadcastListItemType = broadcastListItemTypes.get(i);
			zcdmTProglist = new ZcdmTProglist();// 实例化节目单子表
			zcdmTProglist.setZProItemCd(broadcastListItemType.getBroadcastListItemID()); // 播出单条目标识
			zcdmTProglist.setZSubjPlanId(broadcastListItemType.getColumnPlayPlanID());// 栏目播出计划标识
			zcdmTProglist.setZPlanMatch(broadcastListItemType.getPlanMatchFlag()); // 计划匹配标识
			// 节目播出方式
			zcdmTProglist.setZOrder(broadcastListItemType.getItemIndex().longValue()); // 条目序号
			zcdmTProglist.setZPlayDate(date); // 播出日期
			zcdmTProglist.setZPlayTime(broadcastListItemType.getPlayTime().replace(":", ""));// 播出时间
			zcdmTProglist.setZSubjTime(broadcastListItemType.getDuration().replace(":", ""));// 栏目时长
			zcdmTProglist.setZProRtmlen(broadcastListItemType.getProgDuration().replace(":", "")); // 节目实际长度
			zcdmTProglist.setZAdTime(broadcastListItemType.getADDuration().replace(":", ""));// 中插广告总时长
			zcdmTProglist.setZPlaySubjCd(broadcastListItemType.getColumnCode()); // 播出栏目代码
			// 制作栏目代码
			zcdmTProglist.setZProcode(broadcastListItemType.getProgramCode()); // 节目代码
			zcdmTProglist.setZPgnam(broadcastListItemType.getProgramName());// 节目名称
			zcdmTProglist.setZCapVer(broadcastListItemType.getSubtitleLanguage().getLangCode());// 字幕语言版本
			zcdmTProglist.setZAudVer(broadcastListItemType.getAudioLanguage().getLangCode());// 音频语言版本
			zcdmTProglist.setZHdFlag(broadcastListItemType.getVideo());// 高清标志
			zcdmTProglist.setZAfd(broadcastListItemType.getAFD());// AFD信息
			zcdmTProglist.setZAudioType(broadcastListItemType.getAudio());// 声道信息
			zcdmTProglist.setZCarrierType(broadcastListItemType.getMediaType());// 成品节目交付介质类型
			zcdmTProglist.setZPlayForm(broadcastListItemType.getIsLive());// 播出方式
			zcdmTProglist.setZInsertWay(broadcastListItemType.getIP());// 插播方式.
			zcdmTProglist.setZInForm(broadcastListItemType.getThroughType());// 送播方式
			// TODO: 用X代替true / ""代替false
			if (broadcastListItemType.isNewsFlag()) { // 新闻消息类节目标识.
				zcdmTProglist.setZIsNewsFlag("X");
			} else
				zcdmTProglist.setZIsNewsFlag("");
			zcdmTProglist.setZIsAd(broadcastListItemType.getIsAD());// 是否广告
			// TODO: 用X代替true ""代替false
			if (broadcastListItemType.isIsChannelBranding())
				zcdmTProglist.setZChanlCasing("X");
			else
				zcdmTProglist.setZChanlCasing("");// 是否有包装
			zcdmTProglist.setZProItemSta(broadcastListItemType.getPlayItemReadyStatus());// 播出条目状态
			zcdmTProglist.setZProgSegsum(Long.parseLong(broadcastListItemType.getProgSegmentSum()));// 节目分段总数
			zcdmTProglist.setZLimitAd(broadcastListItemType.getLimitADSegmentSum().longValue());// 广告中插总次数
			// 介质ID
			// 广告段代码
			zcdmTProglist.setZChanlCd(channelCode);// 频道代码
			// 变更锁定
			// 首/重/并播标识
			// 行处理标记
			// 版本号
			// 节目名称修改标识
			// 固定播出时间
			// 重点节目标识
			// 是否有中插
			zcdmTProglist.setZBreakFlg(broadcastListItemType.getBreakFlag());// 卡播标记.
			zcdmTProglist.setZBreakpointId(broadcastListItemType.getBreakPointID());// 插播点ID.
			// 条目注释
			// 是否粗体
			// 复制节目状态
			// 版权验证状态
			// 版权验证日期
			// 版权验证时间
			ListZcdmTProglist.add(zcdmTProglist);
		}
		return ListZcdmTProglist;
	}

	/**
	 * 
	 * @ps:节目变更单主表赋值
	 * @param broadcastListChangeInfoTypes变更单类型
	 * @param zcdmTChange
	 * @return
	 */
	public ZcdmTChange setZcdmTChange(List<BroadcastListChangeInfoType> broadcastListChangeInfoTypes, TaskChangePortService taskChangePortService,
			ZcdmTChange zcdmTChange) {
		if (broadcastListChangeInfoTypes == null) {
			return null;
		}
		// System.out.println("zcdmTChange赋值开始!");
		BroadcastListChangeInfoType broadcastListChangeInfoType = broadcastListChangeInfoTypes.get(0);
		String changeNotifincationID = broadcastListChangeInfoType.getChangeNotifincationID();
		zcdmTChange = new ZcdmTChange();
		zcdmTChange.setZChanCd(changeNotifincationID);// 节目变更单标识
		// 对节目播出单标识进行判断
		if (taskChangePortService.isZcdmTChangeExist(zcdmTChange) != null) {
			return null;// 节目变更单已经存在
		}
		zcdmTChange.setZProRecCd(broadcastListChangeInfoType.getBroadcastListID());// 节目播出单标识
		zcdmTChange.setZApusr(broadcastListChangeInfoType.getChangeApplyPerson().getUserID());// 申请人
		zcdmTChange.setZApdat(broadcastListChangeInfoType.getChangeApplyDate().toGregorianCalendar().getTime());// 申请日期
		zcdmTChange.setZChangeType(broadcastListChangeInfoType.getChangeTypes().getChangeType().get(0));// 变更类型
		zcdmTChange.setZChangeReason(broadcastListChangeInfoType.getChangeReason());// 节目变更原因
		zcdmTChange.setZChanlCd(broadcastListChangeInfoType.getChannelCode());// 频道代码
		zcdmTChange.setZPlayDate(broadcastListChangeInfoType.getPlayDate().toGregorianCalendar().getTime());// 播出日期
		zcdmTChange.setZPredict(broadcastListChangeInfoType.getChangeForecast());// 字幕预告
		zcdmTChange.setZChangeDesc(broadcastListChangeInfoType.getChangeDesc());// 节目变更描述
		// System.out.println("zcdmTChange赋值完毕!");
		return zcdmTChange;
	}

	/**
	 * 
	 * @ps: 处理变更单子表集合
	 * @param broadcastListItemTypes
	 * @param taskChangePortService
	 * @param boolean-->true:变更前 false或者不赋值:变更后
	 * @return
	 */
	public List<ZcdmTChangesub> setChangesubs(BroadcastListChangeInfoType broadcastListChangeInfoType,
			List<BroadcastListItemType> broadcastListItemTypes, TaskChangePortService taskChangePortService, ZcdmTChangesub zcdmTChangesub,
			boolean boo) {
		if (broadcastListItemTypes == null) {
			return null;
		}
		List<ZcdmTChangesub> zcdmTChangesubs = new ArrayList<ZcdmTChangesub>();
		for (int i = 0; i < broadcastListItemTypes.size(); i++) {
			BroadcastListItemType broadcastListItemType = broadcastListItemTypes.get(i);
			String broadcastListItemID = broadcastListItemType.getBroadcastListItemID();// 播出单条目标识
			Date date = broadcastListChangeInfoType.getPlayDate().toGregorianCalendar().getTime();// 播出日期
			String chanlCode = broadcastListChangeInfoType.getChannelCode();// 播出频道代码
			if (boo) { // 当boo值为false时,屏蔽掉内层的if判断
				// TODO 判断播出单条目标识,在节目单子表中是否存在
				if (!taskChangePortService.isZcdmTProglistExist(broadcastListItemID, date, chanlCode)) {
					return null;
				}
			}
			zcdmTChangesub = new ZcdmTChangesub();
			zcdmTChangesub.setZChanCd(broadcastListChangeInfoType.getChangeNotifincationID());// 节目变更单标识
			zcdmTChangesub.setZProItemCd(broadcastListItemID);// 播出单条目标识
			zcdmTChangesub.setZOrder(broadcastListItemType.getItemIndex().toString());// 条目序号
			zcdmTChangesub.setZChanSubTp(boo ? "0" : "1");// 节目变更单条目类型,变更前为0.变更后为1
			zcdmTChangesub.setZSubjPlanId(broadcastListItemType.getColumnPlayPlanID());// 栏目播出计划标识
			zcdmTChangesub.setZPlanMatch(broadcastListItemType.getPlanMatchFlag());// 计划匹配标识
			zcdmTChangesub.setZEvent(broadcastListItemType.getEvent());// 节目播出方式
			zcdmTChangesub.setZPlayDate(date);// 播出日期
			zcdmTChangesub.setZPlayTime(broadcastListItemType.getPlayTime().replace(":", ""));// 播出时间
			zcdmTChangesub.setZSubjTime(broadcastListItemType.getDuration().replace(":", ""));// 栏目时长
			zcdmTChangesub.setZProRtmlen(broadcastListItemType.getProgDuration().replace(":", ""));// 节目实际长度
			zcdmTChangesub.setZProcode(broadcastListItemType.getProgramCode());// 节目代码
			zcdmTChangesub.setZPgnam(broadcastListItemType.getProgramName());// 节目名称
			zcdmTChangesub.setZAudVer(broadcastListItemType.getAudioLanguage().getLangCode());// 音频语言版本
			zcdmTChangesub.setZCapVer(broadcastListItemType.getSubtitleLanguage().getLangCode());// 字幕语言版本
			zcdmTChangesub.setZHdFlag(broadcastListItemType.getVideo());// 高清标志
			zcdmTChangesub.setZAfd(broadcastListItemType.getAFD());// AFD信息
			zcdmTChangesub.setZAudioType(broadcastListItemType.getAudio());// 声道信息
			zcdmTChangesub.setZCarrierType(broadcastListItemType.getMediaType());// 成品节目交付介质类型
			zcdmTChangesub.setZPlayForm(broadcastListItemType.getIsLive());// 播出方式
			zcdmTChangesub.setZInsertWay(broadcastListItemType.getIP());// 插播方式
			zcdmTChangesub.setZInForm(broadcastListItemType.getThroughType());// 送播方式
			if (broadcastListItemType.isNewsFlag())
				zcdmTChangesub.setZIsNewsFlag("X"); // 新闻消息类标识
			else
				zcdmTChangesub.setZIsNewsFlag(" ");
			zcdmTChangesub.setZIsAd(broadcastListItemType.getIsAD());// 是否广告
			if (broadcastListItemType.isIsChannelBranding())// 是否有包装.
				zcdmTChangesub.setZChanlCasing("X");
			else
				zcdmTChangesub.setZChanlCasing(" ");
			zcdmTChangesub.setZProgSegsum(Long.parseLong(broadcastListItemType.getProgSegmentSum()));// 节目分段总数
			zcdmTChangesub.setZAdSegmentId(broadcastListItemType.getADSegmentID());// 广告段代码
			zcdmTChangesub.setZMediaId(broadcastListItemType.getMediaID());// 介质ID
			zcdmTChangesub.setZLimitAd(broadcastListItemType.getLimitADSegmentSum().longValue());// 广告中插总次数
			zcdmTChangesub.setZChanlCd(chanlCode);// 频道代码
			zcdmTChangesub.setZBreakFlg(broadcastListItemType.getBreakFlag());// 卡播标记
			zcdmTChangesub.setZAdTime(broadcastListItemType.getADDuration().replace(":", ""));// 中插广告总时长
			zcdmTChangesub.setZBreakpointId(broadcastListItemType.getBreakPointID());// 插播点ID
			zcdmTChangesubs.add(zcdmTChangesub);
		}
		return zcdmTChangesubs;
	}

	/**
	 * 
	 * @ps:处理变更后的变更单子表集合,boolean默认参数赋值为false
	 * @param broadcastListItemTypes
	 * @param taskChangePortService
	 * @param zcdmTChangesub
	 * @return
	 */
	public List<ZcdmTChangesub> setChangesubs(BroadcastListChangeInfoType broadcastListChangeInfoType,
			List<BroadcastListItemType> broadcastListItemTypes, TaskChangePortService taskChangePortService, ZcdmTChangesub zcdmTChangesub) {
		return setChangesubs(broadcastListChangeInfoType, broadcastListItemTypes, taskChangePortService, zcdmTChangesub, false);
	}

	/**
	 * 
	 * @ps:直播单
	 * @param liveProgramNotificationType
	 * @param zcdmTLive
	 * @return
	 */
	public ZcdmTLive setZcdmTLive(LiveProgramNotificationType liveProgramNotificationType, ZcdmTLive zcdmTLive) {
		if (liveProgramNotificationType == null) {
			return null;
		}
		zcdmTLive = new ZcdmTLive(); // 直播单主表
		zcdmTLive.setZLiveCd(liveProgramNotificationType.getLiveProgramNotificationID()); // 直播协调单编号
		zcdmTLive.setZPgnam(liveProgramNotificationType.getProgramName());// 部门名称
		zcdmTLive.setZProcode(liveProgramNotificationType.getProgramCode());// 部门代码
		zcdmTLive.setZChanlCd(liveProgramNotificationType.getChannelCode()); // 频道代码
		zcdmTLive.setZLiveDate(liveProgramNotificationType.getLivePlayDate().toGregorianCalendar().getTime());// 播出日期
		zcdmTLive.setZLiveBetim(liveProgramNotificationType.getLivePlayTime().replace(":", "")); // 直播起始时间
		zcdmTLive.setZLiveEntim(liveProgramNotificationType.getIsEndTimeSure().replace(":", ""));// 直播结束时间
		zcdmTLive.setZProRtmlen(liveProgramNotificationType.getDuration().replace(":", ""));// 节目实际时长
		zcdmTLive.setZLivePlace(liveProgramNotificationType.getLiveLocale());// 直播现场
		zcdmTLive.setZPlayroom(liveProgramNotificationType.getStudioID());// 直播演播室编号
		zcdmTLive.setZPlayroomNm(liveProgramNotificationType.getStudioName());// 直播演播室名称
		zcdmTLive.setZAudVer(liveProgramNotificationType.getAudioLanguage().getLangCode());// 音频语言版本
		zcdmTLive.setZCapVer(liveProgramNotificationType.getSubtitleLanguage().getLangCode());// 字幕语言版本
		zcdmTLive.setZLiveDelay(liveProgramNotificationType.getDelayTime().toString());// 时延时间
		zcdmTLive.setZComment(liveProgramNotificationType.getLiveComment());// 描述
		return zcdmTLive;
	}

	/**
	 * 
	 * @ps:直播单子表
	 * @param liveProgramNotificationType
	 * @param zcdmTLiveCoor
	 * @return
	 */
	public List<ZcdmTLiveCoor> setZcdmTLiveCoor(LiveProgramNotificationType liveProgramNotificationType, ZcdmTLiveCoor zcdmTLiveCoor) {
		if (liveProgramNotificationType == null) {
			return null;
		}
		List<UserInfoType> userList = liveProgramNotificationType.getAssociatedPersons().getAssociatedPerson();
		List<ZcdmTLiveCoor> ListZcdmCoor = new ArrayList<ZcdmTLiveCoor>();
		for (int i = 0; i < userList.size(); i++) {
			zcdmTLiveCoor = new ZcdmTLiveCoor(); // 直播单子表
			UserInfoType userInfoType = userList.get(i);
			zcdmTLiveCoor.setZLiveCd(liveProgramNotificationType.getLiveProgramNotificationID());
			zcdmTLiveCoor.setZUserId(userInfoType.getUserID());// 用户id
			zcdmTLiveCoor.setZUserNm(userInfoType.getUserName());// 用户名称
			ListZcdmCoor.add(zcdmTLiveCoor);
		}
		return ListZcdmCoor;
	}

	/**
	 * 
	 * @ps:直送通知单
	 * @param directSendNotificationType
	 * @param zcdmTDiresend
	 * @return
	 */
	public ZcdmTDiresend setZcdmTDiresend(DirectSendNotificationType directSendNotificationType, ZcdmTDiresend zcdmTDiresend) {
		if (directSendNotificationType == null) {
			return null;
		}
		zcdmTDiresend.setZDiresendCd(directSendNotificationType.getDirectSendInfoID());// 直送通知单标识
		zcdmTDiresend.setZChanlCd(directSendNotificationType.getChannelCode());// 频道代码
		zcdmTDiresend.setZSubjCd(directSendNotificationType.getColumnCode());// 栏目代码
		zcdmTDiresend.setZPlayDate(directSendNotificationType.getPlayDate().toGregorianCalendar().getTime());// 播出日期
		zcdmTDiresend.setZPlayTime(directSendNotificationType.getPlayTime().replace(":", ""));// 播出时间
		zcdmTDiresend.setZProcode(directSendNotificationType.getProgramCode());// 节目代码
		zcdmTDiresend.setZPgnam(directSendNotificationType.getProgramName());// 节目名称
		zcdmTDiresend.setZAudVer(directSendNotificationType.getAudioLanguage().getLangCode());// 音频语言版本
		zcdmTDiresend.setZCapVer(directSendNotificationType.getSubtitleLanguage().getLangCode());// 字幕语言版本
		zcdmTDiresend.setZProgSegsum(Long.parseLong(directSendNotificationType.getProgSegmentSum()));// 节目分段总数
		zcdmTDiresend.setZDiresendReas(directSendNotificationType.getDirectSendReason());// 直送原因
		zcdmTDiresend.setZDiresendType(directSendNotificationType.getDirectSendType());// 直送介质类型
		zcdmTDiresend.setZComment(directSendNotificationType.getComment());// 备注
		return zcdmTDiresend;
	}

	/**
	 * 
	 * @ps:直送通知单子表
	 * @param directSendNotificationType
	 * @param zcdmTDireCoor
	 * @return
	 */
	public List<ZcdmTDireCoor> setZcdmTDireCoors(DirectSendNotificationType directSendNotificationType, ZcdmTDireCoor zcdmTDireCoor) {
		if (directSendNotificationType == null) {
			return null;
		}
		List<UserInfoType> userList = directSendNotificationType.getCoordinatorInfo().getAssociatedPerson();
		List<ZcdmTDireCoor> ListDireCoors = new ArrayList<ZcdmTDireCoor>();
		for (int i = 0; i < userList.size(); i++) {
			zcdmTDireCoor = new ZcdmTDireCoor();
			UserInfoType userInfoType = userList.get(i);
			zcdmTDireCoor.setZDiresendCd(directSendNotificationType.getDirectSendInfoID());// 直送通知单标识
			zcdmTDireCoor.setZUserId(userInfoType.getUserID());// 用户id
			zcdmTDireCoor.setZUserNm(userInfoType.getUserName());// 用户name
			zcdmTDireCoor.setZComment(directSendNotificationType.getComment());// 备注
			ListDireCoors.add(zcdmTDireCoor);
		}
		return ListDireCoors;
	}

	/**
	 * 
	 * @ps:设置频道类的属性值
	 * @param channelInfoType
	 * @param zcdmTChanl
	 * @return
	 */
	public ZcdmTChanl setZcdmTChanl(ChannelInfoType channelInfoType, ZcdmTChanl zcdmTChanl) {
		if (channelInfoType == null) {
			return null;
		}
		zcdmTChanl = new ZcdmTChanl();
		zcdmTChanl.setZChanlCd(channelInfoType.getChannelCode());// 频道代码
		zcdmTChanl.setZChanlName(channelInfoType.getChannelName());// 频道名称
		// zcdmTChanl.setZChanlBrief(channelInfoType.getChannelDesc());// 频道简称
		// zcdmTChanl.setZHdFlag(channelInfoType.getHDFlag());// 频道高标清类型
		zcdmTChanl.setZChanlType(channelInfoType.getChannelType());// 频道类别
		zcdmTChanl.setZDeptCd(channelInfoType.getAttachCenterDepartment());// 部门代码
		zcdmTChanl.setZBeginDate(channelInfoType.getChannelBeginPlayDate().toGregorianCalendar().getTime());// 开播日期
		if (channelInfoType.getChannelEndPlayDate() == null) {// 停播日期
			zcdmTChanl.setZCloseDate(null);
		} else {
			zcdmTChanl.setZCloseDate(channelInfoType.getChannelEndPlayDate().toGregorianCalendar().getTime());
		}
		zcdmTChanl.setZChanlLangu(channelInfoType.getChannelPlayLanguage());// 频道语言
		zcdmTChanl.setZPlaysite(channelInfoType.getPlaySite()); // 播出地点
		zcdmTChanl.setZChanlArea(channelInfoType.getChannelCoverZone());// 频道地域
		zcdmTChanl.setZChanlStatus(channelInfoType.getChannelState());// 频道状态
		zcdmTChanl.setZBeginTime(channelInfoType.getChannelPlayBeginTime().replace(":", ""));// 开始时间
		zcdmTChanl.setZCloseTime(channelInfoType.getChannelPlayEndTime().replace(":", ""));// 结束时间
		zcdmTChanl.setZDirection(channelInfoType.getChannelDesc());// 定位描述
		zcdmTChanl.setZCrtim(new Date());	//创建时间
		return zcdmTChanl;
	}

	/**
	 * 
	 * @ps:
	 * @param requestHeadType
	 * @param messageCommonDataType
	 * @param zcdmTSms
	 * @return
	 */
	public ZcdmTSms setZcdmTSms(RequestHeadType requestHeadType, MessageCommonDataType messageCommonDataType, ZcdmTSms zcdmTSms) {
		if (requestHeadType == null && messageCommonDataType == null) {
			return null;// 参数异常返回null
		}
		zcdmTSms = new ZcdmTSms();
		zcdmTSms.setZSourceSysId(requestHeadType.getSourceSysID());
		zcdmTSms.setZTargetSysId(requestHeadType.getTargetSysID());
		zcdmTSms.setZRequestId(requestHeadType.getRequestID());
		zcdmTSms.setZTargetService(requestHeadType.getTargetService());
		zcdmTSms.setZMessageType(messageCommonDataType.getMessageType());
		zcdmTSms.setZAppbidType(messageCommonDataType.getAppBidType());
		zcdmTSms.setZContentType(messageCommonDataType.getContentType());
		zcdmTSms.setZRecvsType(messageCommonDataType.getRecvsType());
		zcdmTSms.setZTitleType(messageCommonDataType.getTitleType());
		zcdmTSms.setCreateTimestamp(new Date());
		return zcdmTSms;
	}

	/**
	 * 
	 * @ps:为类MsgReq属性赋值
	 * @param sendMsgServiceRequestType
	 * @return
	 */
	public MsgReq setMsgReq(SendMsgServiceRequestType sendMsgServiceRequestType) {
		MsgReq msgReq = new MsgReq();
		StringBuffer stringBuffer = new StringBuffer();
		msgReq.setZSrcSysId(sendMsgServiceRequestType.getSourceSysID());
		msgReq.setZRegId(sendMsgServiceRequestType.getRegisterNo());
		msgReq.setZContentType(sendMsgServiceRequestType.getMsgType());
		List<String> list = sendMsgServiceRequestType.getReceivePersons().getReceiveUsrCode();
		int size = list.size();
		for (int i = 0; i < size; i++) {
			stringBuffer.append(list.get(i));
			if (i != size - 1) {
				stringBuffer.append(",");
			}
		}
		msgReq.setZMsgType(sendMsgServiceRequestType.getTriggerType());
		msgReq.setZMsgReceiver(stringBuffer.toString());
		msgReq.setCreateTimestamp(new Date());
		return msgReq;
	}
	
	 
	 
}
